package pl.gettoknowme.mobile.android.services.calls;

/**
 * Dane połączeń z pojedynczym numerem telefonu
 * @author Michał Kołodziejski
 */
public class CallSingleNumberStats {

    protected String numberHash;
    protected Long fromTime;
    protected Long toTime;
    protected Long incomingCallsSeconds;
    protected Long outgoingCallsSeconds;
    protected Integer incomingCallsNumber;
    protected Integer outgoingCallsNumber;
    
    public CallSingleNumberStats() {
        incomingCallsSeconds = 0l;
        outgoingCallsSeconds = 0l;
        incomingCallsNumber = 0;
        outgoingCallsNumber = 0;
    }

    public String getNumberHash() {
        return numberHash;
    }

    public void setNumberHash(String numberHash) {
        this.numberHash = numberHash;
    }

    public Long getFromTime() {
        return fromTime;
    }

    public void setFromTime(Long fromTime) {
        this.fromTime = fromTime;
    }

    public Long getToTime() {
        return toTime;
    }

    public void setToTime(Long toTime) {
        this.toTime = toTime;
    }

    public Long getIncomingCallsSeconds() {
        return incomingCallsSeconds;
    }

    public void setIncomingCallsSeconds(Long incomingSeconds) {
        this.incomingCallsSeconds = incomingSeconds;
    }

    public Long getOutgoingCallsSeconds() {
        return outgoingCallsSeconds;
    }

    public void setOutgoingCallsSeconds(Long outgoingSeconds) {
        this.outgoingCallsSeconds = outgoingSeconds;
    }

    public Integer getIncomingCallsNumber() {
        return incomingCallsNumber;
    }

    public void setIncomingCallsNumber(Integer incomingCallsNumber) {
        this.incomingCallsNumber = incomingCallsNumber;
    }

    public Integer getOutgoingCallsNumber() {
        return outgoingCallsNumber;
    }

    public void setOutgoingCallsNumber(Integer outgoingCallsNumber) {
        this.outgoingCallsNumber = outgoingCallsNumber;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((numberHash == null) ? 0 : numberHash.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof CallSingleNumberStats)) {
            return false;
        }
        CallSingleNumberStats other = (CallSingleNumberStats) obj;
        if (numberHash == null) {
            if (other.numberHash != null) {
                return false;
            }
        } else if (!numberHash.equals(other.numberHash)) {
            return false;
        }
        return true;
    }
    
    @Override
    public String toString() {
        return "CallSingleNumberStats["
        + "number: " + numberHash
        + ", total seconds: " + (incomingCallsSeconds + outgoingCallsSeconds)
        + ", total calls number: " + (incomingCallsNumber + outgoingCallsNumber)
        + ", incoming calls seconds: " + incomingCallsSeconds
        + ", outgoing calls seconds: " + outgoingCallsSeconds
        + ", incoming calls number: " + incomingCallsNumber
        + ", outgoing calls number: " + outgoingCallsNumber
        + "]";
    }
}
